package haiyangwangwork.day10.第一组.杨琳;

import java.util.Scanner;

public class Demo1 {
    public static void main(String[] args) {
        //请输入一个字符串，判断有几个af
        Scanner input = new Scanner(System.in);
        //定义一个字符串数据
        System.out.println("请输入一个字符串：");
        String str = input.nextLine();
        char[] chars = str.toCharArray();
        int count = 0;
        for (int i = 0; i < chars.length-1; i++) {
            if (chars[i] == 'a' && chars[i+1] == 'f') {
                count++;

            }
        }
        System.out.println("af的个数为："+count);
//        if (chars == {af}){
//
//        }
    }


}
